<?php

namespace App\Transformers\SystemNotice;

use App\Models\SystemNotice;
use League\Fractal\TransformerAbstract;

class SystemNoticeTransformer extends TransformerAbstract
{
    public function transform(SystemNotice $data){
        return [
            'id' => $data->id,
            'push_admin' => $data->push_admin ?? '',
            'title' => $data->title ?? '',
            'type' => $data->type ?? '',
            'icon' => $data->icon ?? '',
            'url' => $data->url ?? '',
            'table_title' => $data->table_title ?? '',
            'template' => $data->template ?? '',
            'status' => $data->status ?? '',
            'created_at' => $data->created_at ? $data->created_at->format("Y-m-d H:i:s") : '',
            'updated_at' => $data->updated_at ? $data->updated_at->format("Y-m-d H:i:s") : '',
        ];
    }

}
